package com.yuqian.JavaSe.thread.concurrent.visibility;

import java.util.ArrayList;
import java.util.List;

public class NoVisibility {
	private static boolean ready;
	private static int number;
	
	private static class ReadThread extends Thread{
		public void run() {
			if (!ready) {
				Thread.yield();
			}
			System.out.println(number);
		}
	}
	
	public static void main(String[] args) throws InterruptedException {
/*		new  ReadThread().start();
		Thread.sleep(1000);
		ready =true;
		number =42;*/
		List<Integer> arr =new ArrayList<Integer>();
		for(int i=0;i<10;i++){
			arr.add(i);
		}
		
		for(int j=0;arr.iterator().hasNext();j++){
			arr.remove(j);
		}
		
	}

}
